package com.demo.designpattern.factory;

/**
 * Created by hunter
 *
 * @Description 工厂模式
 */
public class MainTest {

    public static void main(String[] args) {
        // ~--------- 简单工厂 begin

        SimpleTeaFactory simpleTeaFactory = new SimpleTeaFactory();
        Tea blackTea = simpleTeaFactory.getTea(TeaEnum.TEA_BLACK);
        Tea greenTea = simpleTeaFactory.getTea(TeaEnum.TEA_GREEN);

        System.out.println(blackTea.getName() + " , " + greenTea.getName());

        // ~--------- 简单工厂 end

        System.out.println("~----------- 华丽的分割线");

        // ~--------- 抽象工厂 begin

        IAbstractTeaFactory blackTeaFactory = new BlackTeaFactory();
        blackTea = blackTeaFactory.getTea();

        IAbstractTeaFactory greenTeaFactory = new GreenTeaFactory();
        greenTea = greenTeaFactory.getTea();

        System.out.println(blackTea.getName() + " , " + greenTea.getName());

        // ~--------- 抽象工厂 end
    }
}
